package com.wzy.tree;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @Author jiangms
 * @Date 2021-04-20 16:06
 * @Desc 多叉树结构
 */
@AllArgsConstructor
@NoArgsConstructor
public class ReportDataTreeNode implements Serializable {

    private ReportDataTreeNode parentNode;
    /**
     * 渲染态格式
     */
    private List<CellInfo> cellInfo = new ArrayList<>();
    /**
     * tree id
     */
    private Integer id;
    /**
     * 动态列name
     */
    private String postion;
    /**
     * 横向还是纵向 0:无 1: 横向 2:纵向
     */
    private Integer treeType;
    /**
     * 是否混合函数
     */
    private Boolean isMixedFunction;

    /**
     * 测试横向
     */
    private List<String> vList;


    /**
     * 测试纵向
     */
    private List<String> hList;
    /**
     * 子结点集合
     */
    private List<ReportDataTreeNode> children = new ArrayList<>();

    public ReportDataTreeNode(Integer id, String postion, CellInfo... vaules) {
        this.id = id;
        this.postion = postion;
        Collections.addAll(cellInfo, vaules);
    }

    public ReportDataTreeNode(Integer id, String postion, Integer treeType, CellInfo... vaules) {
        this(id, postion, vaules);
        this.treeType = treeType;
    }

    public ReportDataTreeNode(Integer id, String postion, List<CellInfo> cellInfo, Integer treeType) {
        this.cellInfo = cellInfo;
        this.id = id;
        this.treeType = treeType;
        this.postion = postion;
    }


    public String getDatas(){
        if(!cellInfo.isEmpty() ){
            return cellInfo.get(0).getV();
        }
        return null;
    }

    public ReportDataTreeNode getParentNode() {
        return parentNode;
    }

    public void setParentNode(ReportDataTreeNode parentNode) {
        this.parentNode = parentNode;
    }

    public List<CellInfo> getCellInfo() {
        return cellInfo;
    }

    public void setCellInfo(List<CellInfo> cellInfo) {
        this.cellInfo = cellInfo;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPostion() {
        return postion;
    }

    public void setPostion(String postion) {
        this.postion = postion;
    }

    public Integer getTreeType() {
        return treeType;
    }

    public void setTreeType(Integer treeType) {
        this.treeType = treeType;
    }

    public List<ReportDataTreeNode> getChildren() {
        return children;
    }

    public void setChildren(List<ReportDataTreeNode> children) {
        this.children = children;
    }

    public Boolean getMixedFunction() {
        return isMixedFunction;
    }

    public void setMixedFunction(Boolean mixedFunction) {
        isMixedFunction = mixedFunction;
    }

    public List<String> getvList() {
        return vList;
    }

    public void setvList(List<String> vList) {
        this.vList = vList;
    }

    public List<String> gethList() {
        return hList;
    }

    public void sethList(List<String> hList) {
        this.hList = hList;
    }
}
